import demo.Employee;
import demo.GroupList;
import demo.Iterator;
import demo.Link;

/**
 * 迭代器模式
 * @author ZhouWeiBo
 * @create 2022/6/7
 */
public class App {
    public static void main(String[] args) {
        GroupList groupList = new GroupList();
        groupList.add(new Employee("1","花花","一级组"));
        groupList.add(new Employee("2","雨雨","二级组-上级组长花花"));
        groupList.add(new Employee("3","小爱","二级组-上级组长花花"));
        groupList.add(new Employee("4","强子","三级组-上级组长小爱"));
        groupList.add(new Employee("5","杨帆","三级组-上级组长小爱"));
        groupList.add(new Employee("6","孙闯","三级组-上级组长雨雨"));
        groupList.add(new Employee("7","郝紫","四级组-上级组长孙闯"));
        groupList.add(new Employee("8","蕾蕾","四级组-上级组长杨帆"));


        groupList.addLink("1",new Link("1","1"));
        groupList.addLink("1",new Link("1","2"));
        groupList.addLink("1",new Link("1","3"));
        groupList.addLink("3",new Link("3","4"));
        groupList.addLink("3",new Link("3","5"));
        groupList.addLink("2",new Link("2","6"));
        groupList.addLink("6",new Link("6","7"));
        groupList.addLink("5",new Link("5","8"));

        Iterator<Employee> iterator = groupList.iterator();
        while (iterator.hasNext()){
            Employee employee = iterator.next();
            System.out.println(employee);
        }

    }
}
